package com.example.studyproject.thread;

import java.util.Collection;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

/**
 * @program: StudyProject
 * @description:
 * @author: kangwei
 * @create: 2025-07-03 16:21
 **/
public interface ExecutorWrapper {

    /**
     * execute 执行
     *
     * @param service
     * @param runExecute
     * @param <E>
     */
    <E extends ExecutorService> void execute(E service, CallExecute runExecute);

    /**
     * submit 提交
     *
     * @param service
     * @param runExecute
     * @param <E>
     * @return
     */
    <E extends ExecutorService> Future<?> submit(E service, CallExecute runExecute);

    /**
     * submit 提交
     *
     * @param service
     * @param runExecute
     * @param <E>
     */
    <E extends ExecutorService> void submitV1(E service, CallExecute runExecute);

    /**
     * 批量提交
     *
     * @param service
     * @param tasks
     * @param <E>
     * @return
     */
    <E extends ExecutorService> List<Future> invokeAll(E service, Collection tasks);

    /**
     * 批量已交
     *
     * @param service
     * @param tasks
     * @param timeout
     * @param unit
     * @param <E>
     * @return
     */
    <E extends ExecutorService> List<Future> invokeAll(E service, Collection tasks, long timeout, TimeUnit unit);


}
